const {contextBridge, ipcRenderer} = require('electron')

const {dialog} = require('electron').remote;
debugger
alert = function(str){
  var options = {
    type: 'warning',
    buttons: ["Ok"],
    defaultId: 0,
    cancelId:0,
    detail:str,
    message: ''
  }
  dialog.showMessageBoxSync(null,options)
}

contextBridge.exposeInMainWorld('myAPI', {
    version: process.version,
    saveFile: (data) => {
        ipcRenderer.send('file-save', data)
    },
    readFile() {
        return ipcRenderer.invoke('file-read')
    }
})
